package com.ruoyi.business.domain.vo;

import cn.hutool.core.util.RandomUtil;
import cn.hutool.crypto.SecureUtil;
import com.ruoyi.business.domain.Bank;
import com.ruoyi.business.domain.BankCard;
import com.ruoyi.common.utils.StringUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 数据实体 : 银行卡VO
 *
 * @Author : ljq
 * @Created : 2025/10/4
 */
@Data
public class BankCardVO extends BankCard {

    ///  real-number

    @Override
    public String getCardNumber() {
        if (StringUtils.isEmpty(super.getCardNumber())) return "";
        String secretKey = super.getCardNumberHash();
        try {
            return SecureUtil.aes(secretKey.getBytes()).decryptStr(super.getCardNumber());
        } catch (Exception e) {
            return "卡号存储受损";
        }
    }

}